﻿Imports CRM.BusinessLayer
Partial Public Class frmSearchCandidate
    Private Sub lvwSearchResults_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles lvwSearchResults.MouseDoubleClick
        If Me.lvwSearchResults.SelectedItems.Count > 0 Then

            GlobalCRM.ResetGlobalVars()

            If IsNumeric(Me.lvwSearchResults.SelectedItem.row.itemarray(0).ToString) Then
                GlobalCRM.CurrentCandidateID = Me.lvwSearchResults.SelectedItem.row.itemarray(0).ToString
                CommonDataFunctions.GblFunc_Goto_ID(GlobalCRM.CurrentCandidateID, CommonDataFunctions.DBIdTypes.PersonID)
            ElseIf IsNumeric(Me.lvwSearchResults.SelectedItem.row.itemarray(4).ToString) Then
                GlobalCRM.CurrentCompanyID = Me.lvwSearchResults.SelectedItem.row.itemarray(4).ToString
                CommonDataFunctions.GblFunc_Goto_ID(GlobalCRM.CurrentCompanyID, CommonDataFunctions.DBIdTypes.CompanyID)
            End If
            'CommonFunc.CloseMDIForm("frmMainDisplay")
            'frmMainDisplay.MdiParent = frmMDIMain
            'frmAddAccount.CloseForm()
            'frmMainDisplay.WindowState = FormWindowState.Maximized
            'frmMainDisplay.Show()
            ' - Redirect this to maindisplay page
            Me.Close()

        End If

    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.Close()
    End Sub

    Private Sub frmSearchCandidate_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
        GeneralTasks.ChangeTheme(Me)
        GeneralTasks.EnumerateandFill(Me.LogicalChildren)
    End Sub
End Class
